#include <iostream>
#include <string>
#include <regex>

using namespace std;

void _test_regex()
{
    string pattern = "[^c]ei";
    pattern = "[[:alpha:]]*" + pattern + "[[:alpha:]]*";
    regex reg(pattern, regex::icase);
    smatch result;
    string str = "hello lei kei cei world";
    // one
    if (regex_search(str, result, reg))
    {
        cout << "find: " << result.str() << endl;
    }
    cout << "---" << endl;
    // all
    regex_iterator<string::iterator> iter(str.begin(), str.end(), reg), end;
    for (; iter != end; ++iter)
    {
        cout << "find: " << iter->str() << endl;
    }
}

int main()
{
    _test_regex();
    return 0;
}